import smtplib
from email.mime.text import MIMEText

mail_host = "smtp.qq.com"
mail_user = "1780754880@qq.com"
mail_pass = "pajdfsgfijfbbhcj"
sender = "1780754880@qq.com"
receivers = ["2056797340@qq.com","1780754880@qq.com"]
receiver = receivers[0]


def send_email(text,email):
    receiver = email
    message = MIMEText(text, 'plain', 'utf-8')

    message['From'] = sender
    message['To'] = receiver
    message['Subject'] = "监控告警"

    smtpObj = smtplib.SMTP_SSL(mail_host, 465)
    smtpObj.login(mail_user, mail_pass)
    smtpObj.sendmail(sender, receiver, message.as_string())
    print('邮件发送成功')

    smtpObj.quit()

